﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SmartCollector.Domain.Repository;
using SmartCollector.Domain.Entity;
namespace SmartCollector.GUI
{
    public partial class AddSite : Form
    {
        private SiteRepository m_siteRepository;
        private tbl_ReferenceSite resite;
        public AddSite()
        {
            InitializeComponent();
            m_siteRepository = new SiteRepository();
            resite = new tbl_ReferenceSite();
        }

        private void m_btnSave_Click(object sender, EventArgs e)
        {
                resite.SiteName = txtSiteName.Text.Trim();
                resite.Url = txtSiteLink.Text.Trim();
                m_siteRepository.AddNewSites(resite);
                DialogResult dr = (MessageBox.Show("Do you want to Save?", "Question", MessageBoxButtons.OK));
                if (dr == DialogResult.OK)
                {
                    m_siteRepository.SubmitChanges();
                    Close();
                }
        }
    }
}
